package com.milkshopbackend.milkshop.common;

public class RedisConstants {
    // 分类相关
    public static final String CATEGORY_TREE_KEY = "milk:category:tree";
    public static final String CATEGORY_KEY_PREFIX = "milk:category:";
    public static final Long CATEGORY_TREE_TTL = 7200L; // 2小时
    public static final Long CATEGORY_TTL = 3600L; // 1小时

    // 空值缓存过期时间
    public static final Long CACHE_NULL_TTL = 60L; // 1分钟

    // 缓存击穿的互斥锁key
    public static final String LOCK_CATEGORY_KEY = "milk:lock:category:";
    public static final Long LOCK_CATEGORY_TTL = 10L; // 10秒

    // 商品相关
    public static final String PRODUCT_KEY_PREFIX = "milk:product:";
    public static final Long PRODUCT_TTL = 3600L; // 1小时
    public static final String LOCK_PRODUCT_KEY = "milk:lock:product:";
    public static final Long LOCK_PRODUCT_TTL = 10L; // 10秒

    // 热门商品列表
    public static final String HOT_PRODUCT_LIST_KEY = "milk:product:list:hot";
    public static final Long HOT_PRODUCT_LIST_TTL = 600L; // 10分钟

    // 热门搜索关键词
    public static final String HOT_SEARCH_KEY = "milk:product:search:hot";
    public static final int HOT_SEARCH_TOP_N = 10;
    public static final Long HOT_SEARCH_RESULT_TTL = 300L; // 5分钟

    // 用户信息缓存
    public static final String USER_INFO_KEY_PREFIX = "milk:user:info:";
    public static final Long USER_INFO_TTL = 3600L; // 1小时
    public static final String LOCK_USER_KEY = "milk:lock:user:";
    public static final Long LOCK_USER_TTL = 10L; // 10秒
} 